package com.yuanlrc.base.entity.admin;

public enum RoleType {

    STUDENT(10L,"学生"),
    ADMINISTRATOR(2L,"管理员");

    private Long code;
    private String value;

    RoleType(Long code, String value) {
        this.code = code;
        this.value = value;
    }

    public Long getCode() {
        return code;
    }

    public void setCode(Long code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    /**
     * 根据code获取value
     * @param code
     * @return
     */
    public static String getValueByCode(int code){
        for(RoleType roleType:RoleType.values()){
            if(code == (roleType.getCode())){
                return roleType.getValue();
            }
        }
        return  null;
    }


}

